<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">

<title>海科任务督办系统</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!-- <link rel="stylesheet" href="resourse/layui-v2.4.3/layui/css/layui.css"> -->
</head>

<body class="easyui-layout">

	<%@ include file="/WEB-INF/jsp/common/header.jsp"%>

	<div data-options="region:'north',border:false"
		style="padding: 0px; overflow: hidden; height: 50px;">

		<div class="easyui-panel"
			style="height: 50px; padding: 10px; background-color: #10a0ea;">
			<div style="float: left;">
				<span style="font-size: 18px; color: #fff;">海科任务督办系统</span>
			</div>
			<div style="float: right; margin: 0 100px 0 0;">
				<a href="javascript:" class="easyui-linkbutton"
					data-options="plain:true">欢迎您：<span id="username"></span></a> <a
					href="javascript:" class="easyui-linkbutton"
					data-options="plain:true"></a> <a href="task/default"
					class="easyui-linkbutton" data-options="plain:true">首页</a> <a
					href="sys/ChangePwd" class="easyui-linkbutton"
					data-options="plain:true">修改密码</a> <a href="sys/logout"
					class="easyui-linkbutton" data-options="plain:true">退出</a>

			</div>
		</div>

		<!-- 		<div -->
		<!-- 			style="text-align: right; position: absolute; top: 0px; right: 10px;"> -->

		<!-- 			<ul id="shortcut"> -->
		<!-- 				<li><a href="javascript:;" title="首页" -->
		<!-- 					onclick="add('/Home/Default','首页');"> <img -->
		<!-- 						src="resourse/img/login/homeico.png" /> <span>首页</span> -->
		<!-- 				</a></li> -->
		<!-- 				<li><a href="javascript:;" title="修改密码" -->
		<!-- 					onclick="add('/Sys/ChangePWD','修改密码');"> <img -->
		<!-- 						src="resourse/img/login/pwdico.png" /><span>修改密码</span> -->
		<!-- 				</a></li>  -->
		<!-- 				<li><a href="sys/logout" title="退出系统"> <img -->
		<!-- 						src="resourse/img/login/quitico.png" /><span>退出系统</span> -->
		<!-- 								</a></li> -->
		<!-- 			</ul> -->
		<!-- 		</div> -->
	</div>
	<div data-options="region:'west',split:true,title:'工具栏'"
		style="width: 300px; padding: 10px;">
		<ul id="tt"></ul>
	</div>
	<div data-options="region:'center'">
		<div id="main" class="easyui-tabs"
			style="width: 99%; height: auto; padding: 0px;"
			data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,closable:false,tools:'#tab-tools111'"
			fit="true" border="0">
			<!--工作区-->
		</div>
		<div id="tab-tools111" style="border-top: none; border-right: none;">
			<a href="javascript:void(0)" class="easyui-linkbutton" plain="true"
				data-options="plain:true,iconCls:'icon-reload'" onclick="refresh()">刷新</a>
		</div>
		<div id="tab_rightmenu" class="easyui-menu"
			style="width: 150px; display: none;">
			<!-- 	<div name="tab_menu-tabclose">关闭</div> -->
			<div name="tab_menu-tabcloseall">关闭全部标签</div>
			<div name="tab_menu-tabcloseother">关闭其他标签</div>
			<div class="menu-sep"></div>
			<div name="tab_menu-tabcloseright">关闭右侧标签</div>
			<div name="tab_menu-tabcloseleft">关闭左侧标签</div>
		</div>
	</div>
	<div data-options="region:'south',border:false"
		style="height: 30px; line-height: 30px; padding-left: 10px; text-align: center;">
		<span> 山东海科化工集团有限公司 </span>
	</div>

	<script type="text/javascript">
		$(function() {
			$("#username").html(PUser.username)
			//绑定左侧Tree
			$('#tt').tree(
					{
						url : 'sys/selectModuleMap?userid=' + PUser.userid,
						lines : true,
						onClick : function(node) {
							if (node.attributes.url != '#'
									&& node.attributes.url != '') { // alert node text property when clicked
								add(node.attributes.url, node.text);
							}
						},
						onLoadSuccess : function() {
							// 							$('#tt').tree('collapseAll');
							//var rows = $('#tt').tree('getChildren');
							//alert(rows[0].ID);
							//if (rows.length) {
							//    $('#tt').tree('expand', rows[0].ID);
							//}
						}
					});
			//add("/PluginSrc/StatisticalSystem/Manage/ReportStateList.aspx", "首页");
			var tabsId = 'main'; //tabs页签Id
			var tab_rightmenuId = 'tab_rightmenu'; //tabs右键菜单Id

			//绑定tabs的右键菜单
			$("#" + tabsId).tabs({
				onContextMenu : function(e, title) {//这时去掉 tabsId所在的div的这个属性：class="easyui-tabs"，否则会加载2次
					e.preventDefault();
					$('#' + tab_rightmenuId).menu('show', {
						left : e.pageX,
						top : e.pageY
					}).data("tabTitle", title);
				}
			});

			//实例化menu的onClick事件
			$("#" + tab_rightmenuId).menu({
				onClick : function(item) {
					CloseTab(tabsId, tab_rightmenuId, item.name);
				}
			});
		});

		var index = 0;
		function add(url, title) {
			if ($('#main').tabs('exists', title)) {
				if (confirm('已经打开了页面,是否关闭并重新加载该标签？\n警告：点击[确定]会关闭原有的标签页面并重新加载！！！如果你还没有保存过数据,请选【取消】！,')) {
					//$('#tt').tabs('select', title);
					$('#main').tabs('close', title);
					$('#main')
							.tabs(
									'add',
									{
										title : title,
										content : "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\""
												+ url
												+ "\" Style=\"width:100%;height:99%;\"></iframe>",
										iconCls : 'icon-applicationgo',
										closable : true
									});
				} else {
					$('#main').tabs('select', title);
				}
			} else {
				$('#main')
						.tabs(
								'add',
								{
									title : title,
									content : "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\""
											+ url
											+ "\" Style=\"width:100%;height:99%;\"></iframe>",
									iconCls : 'icon-applicationgo',
									closable : true
								});
			}
		}

		function refresh() {
			var currTab = $('#main').tabs('getSelected'); //获得当前tab
			if (currTab) {
				var url = $(currTab.panel('options').content).attr('src');
				var title = currTab.panel('options').title;
				$('#main').tabs('close', title);
				add(url, title);
			}
		}
	</script>
	<!-- 	<script src="resourse/layui-v2.4.3/layui/layui.js"></script> -->
	<!-- 	<script> -->
	<!-- 	</script> -->
</body>
</html>
